// #ifndef __MY_LOG_HPP__
//    #define __MY_LOG_HPP__
//    #include <iostream>
//    #include <time.h>
//    #include <unistd.h>

//    #define DEBUG "debug"
//    #define FATAL "fatal"
//    #define ERROR "error"
//    #define log(level,format, ...) do{\
//                               time_t local_time = time(nullptr);\
//                               struct tm* local_tm = localtime(&local_time);\
//                               char time_arr[128] = {0};\
//                               strftime(time_arr,sizeof(time_arr) - 1,"%Y-%m-%d %H:%M:%S",local_tm);\
//                               fprintf(stdout,"[" level": %s: %s %d]" format  "\n", time_arr, __FILE__, __LINE__, ##__VA_ARGS__);\
//                            }while(0)

//    #define debug_log(format,...) log(DEBUG,format, ##__VA_ARGS__)
//    #define fatal_log(format,...) log(FATAL,format, ##__VA_ARGS__)
//    #define error_log(format,...) log(FATAL,format, ##__VA_ARGS__)
// #endif

#ifndef __MY_LOG_HPP__
   #define __MY_LOG_HPP__
   #include <iostream>
   #include <time.h>
   #include <unistd.h>

   #define DEBUG "debug"
   #define FATAL "fatal"
   #define ERROR "error"
   #define mylog(level,format, ...) do{\
                              time_t local_time = time(nullptr);\
                              struct tm* local_tm = localtime(&local_time);\
                              char time_arr[128] = {0};\
                              strftime(time_arr,sizeof(time_arr) - 1,"%Y-%m-%d %H:%M:%S",local_tm);\
                              fprintf(stdout,"[" level": %s: %s %d]" format  "\n", time_arr, __FILE__, __LINE__, ##__VA_ARGS__);\
                           }while(0)

   #define debug_log(format,...) mylog(DEBUG,format, ##__VA_ARGS__)
   #define fatal_log(format,...) mylog(FATAL,format, ##__VA_ARGS__)
   #define error_log(format,...) mylog(FATAL,format, ##__VA_ARGS__)
#endif